export default function useButtonDisabled() {
    function btnDisabled (e: any){
        if(e.target.type === "button"){
            e.target.classList.add("is-disabled")
            e.target.disabled = true
        }
    }
    function clearBtnDisabled(e: any,timeOut = 2000) {
        if(e.target.type === "button"){
            setTimeout(()=>{
                e.target.classList.remove("is-disabled")
                e.target.disabled = false
            },timeOut)
        }
    }
    return {
        btnDisabled,
        clearBtnDisabled
    }
}
